package org.example.test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author ：smart card King
 * @version : 1.0
 * @date : 2023/5/5 14:43
 */
public class Demo02Server {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(8888);

        Socket accept = ss.accept();

        InputStream is = accept.getInputStream();

        byte[] bytes = new byte[1024];
        int len = is.read(bytes);
        System.out.println(new String(bytes,0,len));

        OutputStream os = accept.getOutputStream();

        os.write("收到谢谢".getBytes());

        ss.close();
        os.close();



    }

}
